package org.zjt.demo

/**
  * Created by Administrator on 2017/4/29.
  */
object TestLeftReduce {
  def main(args: Array[String]): Unit = {
    val array = 1 to(5)

    println("相乘的结果："+array.reduceLeft((a,b)=>{ println("执行："+a+"*"+b); a*b }))
    println("相加的结果："+array.reduceLeft((a,b)=>{ println("执行："+a+"+"+b); a+b }))
  }

}
